<?php
class XtranetloginController extends Zend_Controller_Action 
{
    
    
    
    public function indexAction()
    {
    }
    

    public function logoutAction()
    {
        unset($_SESSION['user']);
        
        $this->_redirect($_SERVER['HTTP_REFERER']);
        
    }
    
    public function loginAction()
    {
        $app = Led_Application::getInstance();

        $finder = $app->getEdo()->getFinder('ent_user');

        $found = $finder->findFirst(array
        (
            array('login', '=', $_POST['login']),
            array('password', '=', $_POST['password']),
            ));
        
        if($found)
            $_SESSION['user'] = $found->id;
        
               
        
        $this->_redirect($_SERVER['HTTP_REFERER']);
    }
       
    
}
